<template>
    <div>
      这是一个Vuex.state:{{num}}

         <h1>完成列表</h1>
      <ul>
        <li v-for="thing in finished">{{thing.title}}</li>
      </ul>
      <div>完成:{{summary.finished}};未完成:{{summary.unfinished}}</div>

      <button @click="plusHandler">+</button>
    </div>
</template>

<script>
    export default {
        name: "Second",
      data(){
        return{

          finished:this.$store.getters.finished, //getter 仅仅是 state 的快捷方式
          summary:this.$store.getters.summary
        }
      },methods:{
        plusHandler(){
          this.$store.commit('plus',12)
          this.$store.commit('plus2',{num1:12})
        }
      },computed:{
          num:function () {
            return  this.$store.state.count
          }
      }
    }
</script>

<style scoped>

</style>
